package com.zj.common;

import java.util.ArrayList;
import java.util.List;

import com.zj.common.req.BusinessContent;
import com.zj.common.req.ContentControl;
import com.zj.common.req.Identity;
import com.zj.common.req.ParamList;
import com.zj.common.req.SubPackage;
import com.zj.common.util.ResourceUtil;
import com.zj.common.xml.XmlUtil;
import com.zj.request.*;
import com.zj.request.body.JhSyYhRqLsReqBody;
import com.zj.request.head.JhSyYhRqLsReqHead;

public class BuilderParam {

	public static <T> String geiTird(String serviceId, T t) {
		TiripPackage tiripPackage = new TiripPackage();
		Identity identity = new Identity(serviceId, System.currentTimeMillis() + "");
		tiripPackage.setIdentity(identity);
		tiripPackage.setContentControl(new ContentControl());
		List<ParamList> list = new ArrayList<ParamList>();
		list.add(new ParamList("YH_APP", "310"));
		list.add(new ParamList("tran_time", ResourceUtil.getNowTimeHms()));
		list.add(new ParamList("bwckh", ResourceUtil.getNowTimeHms() + "789654"));
		tiripPackage.setRouterSession(list);
		SubPackage sub = new SubPackage(XmlUtil.addCdata(XmlUtil.toXmlNoHead(t)));
		BusinessContent businessContent = new BusinessContent();
		businessContent.setSubPackage(sub);
		tiripPackage.setBusinessContent(businessContent);
		String body = XmlUtil.toXml(tiripPackage, "GBK");
		return body.trim();
	}

	// 个人银行缴费参保查询请求
	public static String getJhSyYhcxjfTy(JhSyYhCbcxRqBody open) {
		return geiTird("SYYHQ1", open);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 5:45 PM
	 * @describe 个人银行缴费城乡居民查询请求
	 **/
	public static String getJhSyYhCxjmcx(JhSyYhCxjmcxRqBody request) {
		return geiTird("SYYHA1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人银行缴费灵活就业查询请求
	 **/
	public static String getJhSyYhLhjycx(JhSyYhLhjycxRqBody request) {
		return geiTird("SYYHB1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人银行缴费扣款结果确认请求
	 **/
	public static String getJhSyYhKkjg(JhSyYhKkjgRqBody request) {
		return geiTird("SYYHC1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人银行缴费撤销请求
	 **/
	public static String getJhSyYhCx(JhSyYhCxRqBody request) {
		return geiTird("SYYHD1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人委托扣款缴费协议请求
	 **/
	public static String getJhSyYhXy(JhSyYhXyRqBody request) {
		return geiTird("SYXYA1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人税务实时缴费请求
	 **/
	public static String getJhSySk(JhSySkRqBody request) {
		return geiTird("SYSKA1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人缴费交易状态查询请求
	 **/
	public static String getJhSySpztcx(JhSySpztcxRqItem request) {
		return geiTird("SYZTC1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 灵活就业人员缴费基数上下限及档次信息查询请求
	 **/
	public static String getJhSyYhLhjySxxAndDc(JhSyYhLhjySxxAndDcRqBody request) {
		return geiTird("SYYHE1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 城乡居民缴费金额上下限及档次信息查询请求
	 **/
	public static String getJhSyYhCxjmSxxAndDc(JhSyYhCxjmSxxAndDcRqBody request) {
		return geiTird("SYYHF1", request);
	}

	/**
	 * @createUser daiyuan
	 * @createTime 2019/2/20 6:05 PM
	 * @describe 个人缴费日切流水对账请求
	 **/
	public static String getRqls(OpenRequest<JhSyYhRqLsReqHead, JhSyYhRqLsReqBody> request) {
		return geiTird("SYLSY1", request);
	}
}
